<?php
$usrname= $_POST['usrname'];
$password= $_POST['password'];
$conn=mysql_connect("localhost:3306", "root", "root") or die("ERROR: Cannot open database");
$db = "footprintdb";
mysql_select_db($db) or die("ERROR: Cannot open database");
$table = "usrtable";
$sql = "SELECT * FROM usrtable";
$result = mysql_query ( $sql ) or die ( "Error in query execution. ");
$found = false;
$uid=-1;
if (mysql_num_rows ( $result ) > 0) 
{
	while ( $row = mysql_fetch_array ( $result ) ) 
	{
		if ($row ['UsrName'] == $usrname && $row ['Password'] == $password) 
		{
			$found = true;
			$uid=$row ['UsrID'];
			$photo="http://www.smartos.info/footprint".substr($row['PhotoName'],1);
			$sex=$row ['Sex'];
		}
	}
}
	$reply=array(
			'uid'=>$uid,
			'usrname'=>$usrname,
			'pic_url'=>$photo,
			'found'=>$found,
			'sex'=>$sex
			);
echo json_encode($reply);
?>